package com.example.myapplication.room.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;
import com.example.myapplication.room.entity.Student;

import java.util.List;

/**
 * @author sjh
 * @Description
 * @create 2022/3/16 10:22
 */
@Dao
public interface StudentDao {

    @Insert
    void insertStudents(Student... students);

    @Update
    void updateStudents(Student... students);

    @Delete
    void deleteStudent(Student... students);

    @Query("DELETE FROM Student")
    void deleteAllStudents();

    @Query("SELECT * FROM Student ORDER BY ID DESC")
    List<Student> getAllStudent();

}
